home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection 1998 Fall: Game Toolkit / Disc.iso / SDKs / QuickTime Mac / PInterfaces / QD3D.p < prev    next >
Encoding:
Text File  |  1998-04-09  |  32.8 KB  |  1,008 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QD3D.p
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT QD3D;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __QD3D__}
  28. {$SETC __QD3D__ := 1}
  29.  
  30. {$I+}
  31. {$SETC QD3DIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37.  
  38. {$IFC TARGET_OS_MAC }
  39. {$IFC UNDEFINED __MACTYPES__}
  40. {$I MacTypes.p}
  41. {$ENDC}
  42. {$ENDC}  {TARGET_OS_MAC}
  43.  
  44.  
  45. {$PUSH}
  46. {$ALIGN POWER}
  47. {$LibExport+}
  48.  
  49. {$IFC TARGET_OS_MAC }
  50. {$SETC OS_MACINTOSH := 1 }
  51. {$SETC OS_WIN32 := 0 }
  52. {$SETC OS_UNIX := 0 }
  53. {$SETC OS_NEXT := 0 }
  54. {$SETC WINDOW_SYSTEM_MACINTOSH := 1 }
  55. {$SETC WINDOW_SYSTEM_WIN32 := 0 }
  56. {$SETC WINDOW_SYSTEM_X11 := 0 }
  57. {$SETC WINDOW_SYSTEM_NEXT := 0 }
  58. {$ENDC}  {TARGET_OS_MAC}
  59.  
  60.  
  61. {*****************************************************************************
  62.  **                                                                             **
  63.  **                                NULL definition                                 **
  64.  **                                                                             **
  65.  ****************************************************************************}
  66. {*****************************************************************************
  67.  **                                                                             **
  68.  **                                    Objects                                     **
  69.  **                                                                             **
  70.  ****************************************************************************}
  71. {
  72.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  73.  * deletion, duplication, and i/o methods.
  74.  }
  75.  
  76. TYPE
  77.     TQ3ObjectType                        = LONGINT;
  78.     TQ3ObjectTypePtr                    = ^TQ3ObjectType;
  79.     TQ3Object = ^LONGINT;
  80. {   }
  81. {
  82.  * There are four subclasses of OBJECT:
  83.  *    an ELEMENT, which is data that is placed in a SET
  84.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  85.  *    VIEWs, which maintain state information for an image
  86.  *    a PICK, which used to query a VIEW
  87.  }
  88.     TQ3ElementObject                    = TQ3Object;
  89.     TQ3SharedObject                        = TQ3Object;
  90.     TQ3ViewObject                        = TQ3Object;
  91.     TQ3PickObject                        = TQ3Object;
  92. {
  93.  * There are several types of SharedObjects:
  94.  *    RENDERERs, which paint to a drawContext
  95.  *    DRAWCONTEXTs, which are an interface to a device 
  96.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  97.  *    FILEs, which maintain state information for a metafile
  98.  *    SHAPEs, which affect the state of the View
  99.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  100.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  101.  *    TRACKERs, which represent a position and orientation in the user interface
  102.  *  STRINGs, which are abstractions of text string data.
  103.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  104.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  105.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  106.  }
  107.     TQ3RendererObject                    = TQ3SharedObject;
  108.     TQ3DrawContextObject                = TQ3SharedObject;
  109.     TQ3SetObject                        = TQ3SharedObject;
  110.     TQ3FileObject                        = TQ3SharedObject;
  111.     TQ3ShapeObject                        = TQ3SharedObject;
  112.     TQ3ShapePartObject                    = TQ3SharedObject;
  113.     TQ3ControllerStateObject            = TQ3SharedObject;
  114.     TQ3TrackerObject                    = TQ3SharedObject;
  115.     TQ3StringObject                        = TQ3SharedObject;
  116.     TQ3StorageObject                    = TQ3SharedObject;
  117.     TQ3TextureObject                    = TQ3SharedObject;
  118.     TQ3ViewHintsObject                    = TQ3SharedObject;
  119. {
  120.  * There is one types of SET:
  121.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  122.  }
  123.     TQ3AttributeSet                        = TQ3SetObject;
  124.     TQ3AttributeSetPtr                    = ^TQ3AttributeSet;
  125. {
  126.  * There are many types of SHAPEs:
  127.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  128.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  129.  *    GROUPs, which may contain any number of SHARED OBJECTS
  130.  *    GEOMETRYs, which are representations of three-dimensional data
  131.  *    SHADERs, which affect how colors are drawn on a geometry
  132.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  133.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  134.  *    REFERENCEs, which are references to objects in FILEs
  135.  *  UNKNOWN, which hold unknown objects read from a metafile.
  136.  }
  137.     TQ3GroupObject                        = TQ3ShapeObject;
  138.     TQ3GeometryObject                    = TQ3ShapeObject;
  139.     TQ3ShaderObject                        = TQ3ShapeObject;
  140.     TQ3StyleObject                        = TQ3ShapeObject;
  141.     TQ3TransformObject                    = TQ3ShapeObject;
  142.     TQ3LightObject                        = TQ3ShapeObject;
  143.     TQ3CameraObject                        = TQ3ShapeObject;
  144.     TQ3UnknownObject                    = TQ3ShapeObject;
  145.     TQ3ReferenceObject                    = TQ3ShapeObject;
  146. {
  147.  * For now, there is only one type of SHAPEPARTs:
  148.  *    MESHPARTs, which describe some part of a mesh
  149.  }
  150.     TQ3MeshPartObject                    = TQ3ShapePartObject;
  151. {
  152.  * There are three types of MESHPARTs:
  153.  *    MESHFACEPARTs, which describe a face of a mesh
  154.  *    MESHEDGEPARTs, which describe a edge of a mesh
  155.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  156.  }
  157.     TQ3MeshFacePartObject                = TQ3MeshPartObject;
  158.     TQ3MeshEdgePartObject                = TQ3MeshPartObject;
  159.     TQ3MeshVertexPartObject                = TQ3MeshPartObject;
  160. {
  161.  * A DISPLAY Group can be drawn to a view
  162.  }
  163.     TQ3DisplayGroupObject                = TQ3GroupObject;
  164. {
  165.  * There are many types of SHADERs:
  166.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  167.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  168.  }
  169.     TQ3SurfaceShaderObject                = TQ3ShaderObject;
  170.     TQ3IlluminationShaderObject            = TQ3ShaderObject;
  171. {
  172.  * A handle to an object in a group
  173.  }
  174.     TQ3GroupPosition = ^LONGINT;
  175.     TQ3GroupPositionPtr                    = ^TQ3GroupPosition;
  176.  * TQ3ObjectClassNameString is used for the class name of an object
  177.  }
  178.  
  179. CONST
  180.     kQ3StringMaximumLength        = 1024;
  181.  
  182.  
  183. TYPE
  184.     TQ3ObjectClassNameString            = PACKED ARRAY [0..1023] OF CHAR;
  185. {*****************************************************************************
  186.  **                                                                             **
  187.  **                            Client/Server Things                             **
  188.  **                                                                             **
  189.  ****************************************************************************}
  190.     TQ3ControllerRef                    = Ptr;
  191. {*****************************************************************************
  192.  **                                                                             **
  193.  **                            Flags and Switches                                 **
  194.  **                                                                             **
  195.  ****************************************************************************}
  196.     TQ3Boolean                     = LONGINT;
  197. CONST
  198.     kQ3False                    = {TQ3Boolean}0;
  199.     kQ3True                        = {TQ3Boolean}1;
  200.  
  201.  
  202. TYPE
  203.     TQ3Switch                     = LONGINT;
  204. CONST
  205.     kQ3Off                        = {TQ3Switch}0;
  206.     kQ3On                        = {TQ3Switch}1;
  207.  
  208.  
  209. TYPE
  210.     TQ3Status                     = LONGINT;
  211. CONST
  212.     kQ3Failure                    = {TQ3Status}0;
  213.     kQ3Success                    = {TQ3Status}1;
  214.  
  215.  
  216. TYPE
  217.     TQ3Axis                     = LONGINT;
  218. CONST
  219.     kQ3AxisX                    = {TQ3Axis}0;
  220.     kQ3AxisY                    = {TQ3Axis}1;
  221.     kQ3AxisZ                    = {TQ3Axis}2;
  222.  
  223.  
  224. TYPE
  225.     TQ3PixelType                 = LONGINT;
  226. CONST
  227.     kQ3PixelTypeRGB32            = {TQ3PixelType}0;                {  Alpha:8 (ignored), R:8, G:8, B:8     }
  228.     kQ3PixelTypeARGB32            = {TQ3PixelType}1;                {  Alpha:8, R:8, G:8, B:8              }
  229.     kQ3PixelTypeRGB16            = {TQ3PixelType}2;                {  Alpha:1 (ignored), R:5, G:5, B:5     }
  230.     kQ3PixelTypeARGB16            = {TQ3PixelType}3;                {  Alpha:1, R:5, G:5, B:5              }
  231.     kQ3PixelTypeRGB16_565        = {TQ3PixelType}4;                {  Win32 only: 16 bits/pixel, R:5, G:6, B:5         }
  232.     kQ3PixelTypeRGB24            = {TQ3PixelType}5;                {  Win32 only: 24 bits/pixel, R:8, G:8, B:8         }
  233.  
  234.  
  235. TYPE
  236.     TQ3Endian                     = LONGINT;
  237. CONST
  238.     kQ3EndianBig                = {TQ3Endian}0;
  239.     kQ3EndianLittle                = {TQ3Endian}1;
  240.  
  241.  
  242. TYPE
  243.     TQ3EndCapMasks                 = LONGINT;
  244. CONST
  245.     kQ3EndCapNone                = {TQ3EndCapMasks}0;
  246.     kQ3EndCapMaskTop            = {TQ3EndCapMasks}$01;
  247.     kQ3EndCapMaskBottom            = {TQ3EndCapMasks}$02;
  248.     kQ3EndCapMaskInterior        = {TQ3EndCapMasks}$04;
  249.  
  250.  
  251. TYPE
  252.     TQ3EndCap                            = UInt32;
  253.  
  254. CONST
  255.     kQ3ArrayIndexNULL            = -1;
  256.  
  257. {*****************************************************************************
  258.  **                                                                             **
  259.  **                        Point and Vector Definitions                         **
  260.  **                                                                             **
  261.  ****************************************************************************}
  262.  
  263. TYPE
  264.     TQ3Vector2DPtr = ^TQ3Vector2D;
  265.     TQ3Vector2D = RECORD
  266.         x:                        Single;
  267.         y:                        Single;
  268.     END;
  269.  
  270.     TQ3Vector3DPtr = ^TQ3Vector3D;
  271.     TQ3Vector3D = RECORD
  272.         x:                        Single;
  273.         y:                        Single;
  274.         z:                        Single;
  275.     END;
  276.  
  277.     TQ3Point2DPtr = ^TQ3Point2D;
  278.     TQ3Point2D = RECORD
  279.         x:                        Single;
  280.         y:                        Single;
  281.     END;
  282.  
  283.     TQ3Point3DPtr = ^TQ3Point3D;
  284.     TQ3Point3D = RECORD
  285.         x:                        Single;
  286.         y:                        Single;
  287.         z:                        Single;
  288.     END;
  289.  
  290.     TQ3RationalPoint4DPtr = ^TQ3RationalPoint4D;
  291.     TQ3RationalPoint4D = RECORD
  292.         x:                        Single;
  293.         y:                        Single;
  294.         z:                        Single;
  295.         w:                        Single;
  296.     END;
  297.  
  298.     TQ3RationalPoint3DPtr = ^TQ3RationalPoint3D;
  299.     TQ3RationalPoint3D = RECORD
  300.         x:                        Single;
  301.         y:                        Single;
  302.         w:                        Single;
  303.     END;
  304.  
  305. {*****************************************************************************
  306.  **                                                                             **
  307.  **                                Quaternion                                     **
  308.  **                                                                             **
  309.  ****************************************************************************}
  310.     TQ3QuaternionPtr = ^TQ3Quaternion;
  311.     TQ3Quaternion = RECORD
  312.         w:                        Single;
  313.         x:                        Single;
  314.         y:                        Single;
  315.         z:                        Single;
  316.     END;
  317.  
  318. {*****************************************************************************
  319.  **                                                                             **
  320.  **                                Ray Definition                                 **
  321.  **                                                                             **
  322.  ****************************************************************************}
  323.     TQ3Ray3DPtr = ^TQ3Ray3D;
  324.     TQ3Ray3D = RECORD
  325.         origin:                    TQ3Point3D;
  326.         direction:                TQ3Vector3D;
  327.     END;
  328.  
  329. {*****************************************************************************
  330.  **                                                                             **
  331.  **                        Parameterization Data Structures                     **
  332.  **                                                                             **
  333.  ****************************************************************************}
  334.     TQ3Param2DPtr = ^TQ3Param2D;
  335.     TQ3Param2D = RECORD
  336.         u:                        Single;
  337.         v:                        Single;
  338.     END;
  339.  
  340.     TQ3Param3DPtr = ^TQ3Param3D;
  341.     TQ3Param3D = RECORD
  342.         u:                        Single;
  343.         v:                        Single;
  344.         w:                        Single;
  345.     END;
  346.  
  347.     TQ3Tangent2DPtr = ^TQ3Tangent2D;
  348.     TQ3Tangent2D = RECORD
  349.         uTangent:                TQ3Vector3D;
  350.         vTangent:                TQ3Vector3D;
  351.     END;
  352.  
  353.     TQ3Tangent3DPtr = ^TQ3Tangent3D;
  354.     TQ3Tangent3D = RECORD
  355.         uTangent:                TQ3Vector3D;
  356.         vTangent:                TQ3Vector3D;
  357.         wTangent:                TQ3Vector3D;
  358.     END;
  359.  
  360. {*****************************************************************************
  361.  **                                                                             **
  362.  **                        Polar and Spherical Coordinates                         **
  363.  **                                                                             **
  364.  ****************************************************************************}
  365.     TQ3PolarPointPtr = ^TQ3PolarPoint;
  366.     TQ3PolarPoint = RECORD
  367.         r:                        Single;
  368.         theta:                    Single;
  369.     END;
  370.  
  371.     TQ3SphericalPointPtr = ^TQ3SphericalPoint;
  372.     TQ3SphericalPoint = RECORD
  373.         rho:                    Single;
  374.         theta:                    Single;
  375.         phi:                    Single;
  376.     END;
  377.  
  378. {*****************************************************************************
  379.  **                                                                             **
  380.  **                            Color Definition                                 **
  381.  **                                                                             **
  382.  ****************************************************************************}
  383.     TQ3ColorRGBPtr = ^TQ3ColorRGB;
  384.     TQ3ColorRGB = RECORD
  385.         r:                        Single;
  386.         g:                        Single;
  387.         b:                        Single;
  388.     END;
  389.  
  390.     TQ3ColorARGBPtr = ^TQ3ColorARGB;
  391.     TQ3ColorARGB = RECORD
  392.         a:                        Single;
  393.         r:                        Single;
  394.         g:                        Single;
  395.         b:                        Single;
  396.     END;
  397.  
  398. {*****************************************************************************
  399.  **                                                                             **
  400.  **                                    Vertices                                 **
  401.  **                                                                             **
  402.  ****************************************************************************}
  403.     TQ3Vertex3DPtr = ^TQ3Vertex3D;
  404.     TQ3Vertex3D = RECORD
  405.         point:                    TQ3Point3D;
  406.         attributeSet:            TQ3AttributeSet;
  407.     END;
  408.  
  409. {*****************************************************************************
  410.  **                                                                             **
  411.  **                                    Matrices                                 **
  412.  **                                                                             **
  413.  ****************************************************************************}
  414.     TQ3Matrix3x3Ptr = ^TQ3Matrix3x3;
  415.     TQ3Matrix3x3 = RECORD
  416.         value:                    ARRAY [0..2,0..2] OF Single;
  417.     END;
  418.  
  419.     TQ3Matrix4x4Ptr = ^TQ3Matrix4x4;
  420.     TQ3Matrix4x4 = RECORD
  421.         value:                    ARRAY [0..3,0..3] OF Single;
  422.     END;
  423.  
  424. {*****************************************************************************
  425.  **                                                                             **
  426.  **                                Bitmap/Pixmap                                 **
  427.  **                                                                             **
  428.  ****************************************************************************}
  429.     TQ3PixmapPtr = ^TQ3Pixmap;
  430.     TQ3Pixmap = RECORD
  431.         image:                    Ptr;
  432.         width:                    UInt32;
  433.         height:                    UInt32;
  434.         rowBytes:                UInt32;
  435.         pixelSize:                UInt32;                                    {  MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS }
  436.         pixelType:                TQ3PixelType;
  437.         bitOrder:                TQ3Endian;
  438.         byteOrder:                TQ3Endian;
  439.     END;
  440.  
  441.     TQ3StoragePixmapPtr = ^TQ3StoragePixmap;
  442.     TQ3StoragePixmap = RECORD
  443.         image:                    TQ3StorageObject;
  444.         width:                    UInt32;
  445.         height:                    UInt32;
  446.         rowBytes:                UInt32;
  447.         pixelSize:                UInt32;                                    {  MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS }
  448.         pixelType:                TQ3PixelType;
  449.         bitOrder:                TQ3Endian;
  450.         byteOrder:                TQ3Endian;
  451.     END;
  452.  
  453.     TQ3BitmapPtr = ^TQ3Bitmap;
  454.     TQ3Bitmap = RECORD
  455.         image:                    Ptr;
  456.         width:                    UInt32;
  457.         height:                    UInt32;
  458.         rowBytes:                UInt32;
  459.         bitOrder:                TQ3Endian;
  460.     END;
  461.  
  462.     TQ3MipmapImagePtr = ^TQ3MipmapImage;
  463.     TQ3MipmapImage = RECORD
  464.                                                                         {  An image for use as a texture mipmap   }
  465.         width:                    UInt32;                                    {  Width of mipmap, must be power of 2    }
  466.         height:                    UInt32;                                    {  Height of mipmap, must be power of 2   }
  467.         rowBytes:                UInt32;                                    {  Rowbytes of mipmap                     }
  468.         offset:                    UInt32;                                    {  Offset from image base to this mipmap  }
  469.     END;
  470.  
  471.     TQ3MipmapPtr = ^TQ3Mipmap;
  472.     TQ3Mipmap = RECORD
  473.         image:                    TQ3StorageObject;                        {  Data containing the texture map and       }
  474.                                                                         {  if (useMipmapping==kQ3True) the           }
  475.                                                                         {  mipmap data                               }
  476.         useMipmapping:            TQ3Boolean;                                {  True if mipmapping should be used       }
  477.                                                                         {  and all mipmaps have been provided     }
  478.         pixelType:                TQ3PixelType;
  479.         bitOrder:                TQ3Endian;
  480.         byteOrder:                TQ3Endian;
  481.         reserved:                UInt32;                                    {  leave NULL for next version              }
  482.         mipmaps:                ARRAY [0..31] OF TQ3MipmapImage;        {  The actual number of mipmaps is determined from the size of the first mipmap  }
  483.     END;
  484.  
  485.  
  486. {*****************************************************************************
  487.  **                                                                             **
  488.  **                        Higher dimension quantities                             **
  489.  **                                                                             **
  490.  ****************************************************************************}
  491.     TQ3AreaPtr = ^TQ3Area;
  492.     TQ3Area = RECORD
  493.         min:                    TQ3Point2D;
  494.         max:                    TQ3Point2D;
  495.     END;
  496.  
  497.     TQ3PlaneEquationPtr = ^TQ3PlaneEquation;
  498.     TQ3PlaneEquation = RECORD
  499.         normal:                    TQ3Vector3D;
  500.         constant:                Single;
  501.     END;
  502.  
  503.     TQ3BoundingBoxPtr = ^TQ3BoundingBox;
  504.     TQ3BoundingBox = RECORD
  505.         min:                    TQ3Point3D;
  506.         max:                    TQ3Point3D;
  507.         isEmpty:                TQ3Boolean;
  508.     END;
  509.  
  510.     TQ3BoundingSpherePtr = ^TQ3BoundingSphere;
  511.     TQ3BoundingSphere = RECORD
  512.         origin:                    TQ3Point3D;
  513.         radius:                    Single;
  514.         isEmpty:                TQ3Boolean;
  515.     END;
  516.  
  517. {
  518.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  519.  *    calls in the View. It's a hint to the system as to how it should 
  520.  *    compute the bbox of a shape:
  521.  *
  522.  *    kQ3ComputeBoundsExact:    
  523.  *        Vertices of shapes are transformed into world space and
  524.  *        the world space bounding box is computed from them.  Slow!
  525.  *    
  526.  *    kQ3ComputeBoundsApproximate: 
  527.  *        A local space bounding box is computed from a shape's
  528.  *        vertices.  This bbox is then transformed into world space,
  529.  *        and its bounding box is taken as the shape's approximate
  530.  *        bbox.  Fast but the bbox is larger than optimal.
  531.  }
  532.     TQ3ComputeBounds             = LONGINT;
  533. CONST
  534.     kQ3ComputeBoundsExact        = {TQ3ComputeBounds}0;
  535.     kQ3ComputeBoundsApproximate    = {TQ3ComputeBounds}1;
  536.  
  537.  
  538. {*****************************************************************************
  539.  **                                                                             **
  540.  **                            Object System Types                                 **
  541.  **                                                                             **
  542.  ****************************************************************************}
  543.  
  544.  
  545. TYPE
  546.     TQ3XObjectClass = ^LONGINT;
  547.     TQ3XMethodType                        = UInt32;
  548. {
  549.  * Object methods
  550.  }
  551.  *  Return true from the metahandler if this 
  552.  *  object can be submitted in a rendering loop 
  553.  }
  554. {$IFC TYPED_FUNCTION_POINTERS}
  555.     TQ3XFunctionPointer = PROCEDURE; C;
  556. {$ELSEC}
  557.     TQ3XFunctionPointer = ProcPtr;
  558. {$ENDC}
  559.  
  560. {$IFC TYPED_FUNCTION_POINTERS}
  561.     TQ3XMetaHandler = FUNCTION(methodType: TQ3XMethodType): TQ3XFunctionPointer; C;
  562. {$ELSEC}
  563.     TQ3XMetaHandler = ProcPtr;
  564. {$ENDC}
  565.  
  566. {
  567.  * MetaHandler:
  568.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  569.  *        times to build method tables, and then is thrown away. You are 
  570.  *        guaranteed that your metahandler will never be called again after a 
  571.  *        call that was passed a metahandler returns.
  572.  *
  573.  *        Your metahandler should contain a switch on the methodType passed to it
  574.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  575.  *
  576.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  577.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  578.  *
  579.  *        These types here are prototypes of how your functions should look.
  580.  }
  581. {$IFC TYPED_FUNCTION_POINTERS}
  582.     TQ3XObjectUnregisterMethod = FUNCTION(objectClass: TQ3XObjectClass): TQ3Status; C;
  583. {$ELSEC}
  584.     TQ3XObjectUnregisterMethod = ProcPtr;
  585. {$ENDC}
  586.  
  587. {
  588.  * See QD3DIO.h for the IO method types: 
  589.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  590.  }
  591.  
  592. {*****************************************************************************
  593.  **                                                                             **
  594.  **                                Set Types                                     **
  595.  **                                                                             **
  596.  ****************************************************************************}
  597.     TQ3ElementType                        = LONGINT;
  598.  
  599. CONST
  600.     kQ3ElementTypeNone            = 0;
  601.     kQ3ElementTypeUnknown        = 32;
  602.     kQ3ElementTypeSet            = 33;
  603.  
  604.  
  605.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  606.  *    
  607.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  608.  *        
  609.  *        Note that the object is always referenced when copying around. 
  610.  *        
  611.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  612.  *        group of other "objects" which have been found in the metafile and
  613.  *        have no attachment method to their parent. Be prepared to handle
  614.  *        any or all of these cases if you actually access the set on a shape.
  615.  *
  616.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  617.  *    
  618.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  619.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  620.  *            
  621.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  622.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  623.  *    
  624.  *        Note that the object is always referenced when copying around. 
  625.  *        
  626.  *    See the note below about the Set and Shape changes.
  627.  }
  628.  
  629. {*****************************************************************************
  630.  **                                                                             **
  631.  **                            Object System Macros                             **
  632.  **                                                                             **
  633.  ****************************************************************************}
  634. {*****************************************************************************
  635.  **                                                                             **
  636.  **                                Object Types                                 **
  637.  **                                                                             **
  638.  ****************************************************************************}
  639. {
  640.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  641.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  642.  }
  643.  
  644.     kQ3ObjectTypeInvalid        = 0;
  645.     kQ3ObjectTypeView            = 'view';
  646.     kQ3ObjectTypeElement        = 'elmn';
  647.     kQ3ElementTypeAttribute        = 'eatt';
  648.     kQ3ObjectTypePick            = 'pick';
  649.     kQ3PickTypeWindowPoint        = 'pkwp';
  650.     kQ3PickTypeWindowRect        = 'pkwr';
  651.     kQ3ObjectTypeShared            = 'shrd';
  652.     kQ3SharedTypeRenderer        = 'rddr';
  653.     kQ3RendererTypeWireFrame    = 'wrfr';
  654.     kQ3RendererTypeGeneric        = 'gnrr';
  655.     kQ3RendererTypeInteractive    = 'ctwn';
  656.     kQ3SharedTypeShape            = 'shap';
  657.     kQ3ShapeTypeGeometry        = 'gmtr';
  658.     kQ3GeometryTypeBox            = 'box ';
  659.     kQ3GeometryTypeGeneralPolygon = 'gpgn';
  660.     kQ3GeometryTypeLine            = 'line';
  661.     kQ3GeometryTypeMarker        = 'mrkr';
  662.     kQ3GeometryTypePixmapMarker    = 'mrkp';
  663.     kQ3GeometryTypeMesh            = 'mesh';
  664.     kQ3GeometryTypeNURBCurve    = 'nrbc';
  665.     kQ3GeometryTypeNURBPatch    = 'nrbp';
  666.     kQ3GeometryTypePoint        = 'pnt ';
  667.     kQ3GeometryTypePolygon        = 'plyg';
  668.     kQ3GeometryTypePolyLine        = 'plyl';
  669.     kQ3GeometryTypeTriangle        = 'trng';
  670.     kQ3GeometryTypeTriGrid        = 'trig';
  671.     kQ3GeometryTypeCone            = 'cone';
  672.     kQ3GeometryTypeCylinder        = 'cyln';
  673.     kQ3GeometryTypeDisk            = 'disk';
  674.     kQ3GeometryTypeEllipse        = 'elps';
  675.     kQ3GeometryTypeEllipsoid    = 'elpd';
  676.     kQ3GeometryTypePolyhedron    = 'plhd';
  677.     kQ3GeometryTypeTorus        = 'tors';
  678.     kQ3GeometryTypeTriMesh        = 'tmsh';
  679.     kQ3ShapeTypeShader            = 'shdr';
  680.     kQ3ShaderTypeSurface        = 'sush';
  681.     kQ3SurfaceShaderTypeTexture    = 'txsu';
  682.     kQ3ShaderTypeIllumination    = 'ilsh';
  683.     kQ3IlluminationTypePhong    = 'phil';
  684.     kQ3IlluminationTypeLambert    = 'lmil';
  685.     kQ3IlluminationTypeNULL        = 'nuil';
  686.     kQ3ShapeTypeStyle            = 'styl';
  687.     kQ3StyleTypeBackfacing        = 'bckf';
  688.     kQ3StyleTypeInterpolation    = 'intp';
  689.     kQ3StyleTypeFill            = 'fist';
  690.     kQ3StyleTypePickID            = 'pkid';
  691.     kQ3StyleTypeReceiveShadows    = 'rcsh';
  692.     kQ3StyleTypeHighlight        = 'high';
  693.     kQ3StyleTypeSubdivision        = 'sbdv';
  694.     kQ3StyleTypeOrientation        = 'ofdr';
  695.     kQ3StyleTypePickParts        = 'pkpt';
  696.     kQ3StyleTypeAntiAlias        = 'anti';
  697.     kQ3ShapeTypeTransform        = 'xfrm';
  698.     kQ3TransformTypeMatrix        = 'mtrx';
  699.     kQ3TransformTypeScale        = 'scal';
  700.     kQ3TransformTypeTranslate    = 'trns';
  701.     kQ3TransformTypeRotate        = 'rott';
  702.     kQ3TransformTypeRotateAboutPoint = 'rtap';
  703.     kQ3TransformTypeRotateAboutAxis = 'rtaa';
  704.     kQ3TransformTypeQuaternion    = 'qtrn';
  705.     kQ3TransformTypeReset        = 'rset';
  706.     kQ3ShapeTypeLight            = 'lght';
  707.     kQ3LightTypeAmbient            = 'ambn';
  708.     kQ3LightTypeDirectional        = 'drct';
  709.     kQ3LightTypePoint            = 'pntl';
  710.     kQ3LightTypeSpot            = 'spot';
  711.     kQ3ShapeTypeCamera            = 'cmra';
  712.     kQ3CameraTypeOrthographic    = 'orth';
  713.     kQ3CameraTypeViewPlane        = 'vwpl';
  714.     kQ3CameraTypeViewAngleAspect = 'vana';
  715.     kQ3ShapeTypeGroup            = 'grup';
  716.     kQ3GroupTypeDisplay            = 'dspg';
  717.     kQ3DisplayGroupTypeOrdered    = 'ordg';
  718.     kQ3DisplayGroupTypeIOProxy    = 'iopx';
  719.     kQ3GroupTypeLight            = 'lghg';
  720.     kQ3GroupTypeInfo            = 'info';
  721.     kQ3ShapeTypeUnknown            = 'unkn';
  722.     kQ3UnknownTypeText            = 'uktx';
  723.     kQ3UnknownTypeBinary        = 'ukbn';
  724.     kQ3ShapeTypeReference        = 'rfrn';
  725.     kQ3ReferenceTypeExternal    = 'rfex';
  726.     kQ3SharedTypeSet            = 'set ';
  727.     kQ3SetTypeAttribute            = 'attr';
  728.     kQ3SharedTypeDrawContext    = 'dctx';
  729.     kQ3DrawContextTypePixmap    = 'dpxp';
  730.     kQ3DrawContextTypeMacintosh    = 'dmac';
  731.     kQ3DrawContextTypeWin32DC    = 'dw32';
  732.     kQ3DrawContextTypeDDSurface    = 'ddds';
  733.     kQ3DrawContextTypeX11        = 'dx11';
  734.     kQ3SharedTypeTexture        = 'txtr';
  735.     kQ3TextureTypePixmap        = 'txpm';
  736.     kQ3TextureTypeMipmap        = 'txmm';
  737.     kQ3SharedTypeFile            = 'file';
  738.     kQ3SharedTypeStorage        = 'strg';
  739.     kQ3StorageTypeMemory        = 'mems';
  740.     kQ3MemoryStorageTypeHandle    = 'hndl';
  741.     kQ3StorageTypeUnix            = 'uxst';
  742.     kQ3UnixStorageTypePath        = 'unix';
  743.     kQ3StorageTypeMacintosh        = 'macn';
  744.     kQ3MacintoshStorageTypeFSSpec = 'macp';
  745.     kQ3StorageTypeWin32            = 'wist';
  746.     kQ3SharedTypeString            = 'strn';
  747.     kQ3StringTypeCString        = 'strc';
  748.     kQ3SharedTypeShapePart        = 'sprt';
  749.     kQ3ShapePartTypeMeshPart    = 'spmh';
  750.     kQ3MeshPartTypeMeshFacePart    = 'mfac';
  751.     kQ3MeshPartTypeMeshEdgePart    = 'medg';
  752.     kQ3MeshPartTypeMeshVertexPart = 'mvtx';
  753.     kQ3SharedTypeControllerState = 'ctst';
  754.     kQ3SharedTypeTracker        = 'trkr';
  755.     kQ3SharedTypeViewHints        = 'vwhn';
  756.     kQ3SharedTypeEndGroup        = 'endg';
  757.  
  758. {*****************************************************************************
  759.  **                                                                             **
  760.  **                            QuickDraw 3D System Routines                     **
  761.  **                                                                             **
  762.  ****************************************************************************}
  763. FUNCTION Q3Initialize: TQ3Status; C;
  764. FUNCTION Q3Exit: TQ3Status; C;
  765. FUNCTION Q3IsInitialized: TQ3Boolean; C;
  766. FUNCTION Q3GetVersion(VAR majorRevision: UInt32; VAR minorRevision: UInt32): TQ3Status; C;
  767. {
  768.  *  Q3GetReleaseVersion returns the release version number,
  769.  *  in the format of the first four bytes of a 'vers' resource
  770.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  771.  }
  772. FUNCTION Q3GetReleaseVersion(VAR releaseRevision: UInt32): TQ3Status; C;
  773.  
  774. {*****************************************************************************
  775.  **                                                                             **
  776.  **                            ObjectClass Routines                             **
  777.  **                                                                             **
  778.  ****************************************************************************}
  779.  *  New object system calls to query the object system.
  780.  *
  781.  *  These comments to move to the stubs file before final release, they 
  782.  *  are here for documentation for developers using early seeds.
  783.  }
  784. {
  785.  *  Given a class name as a string return the associated class type for the 
  786.  *  class, may return kQ3Failure if the string representing the class is 
  787.  *  invalid.
  788.  }
  789. FUNCTION Q3ObjectHierarchy_GetTypeFromString(VAR objectClassString: TQ3ObjectClassNameString; VAR objectClassType: TQ3ObjectType): TQ3Status; C;
  790. {
  791.  *  Given a class type as return the associated string for the class name, 
  792.  *  may return kQ3Failure if the type representing the class is invalid.
  793.  }
  794. FUNCTION Q3ObjectHierarchy_GetStringFromType(objectClassType: TQ3ObjectType; VAR objectClassString: TQ3ObjectClassNameString): TQ3Status; C;
  795.  *  Return true if the class with this type is registered, false if not 
  796.  }
  797. FUNCTION Q3ObjectHierarchy_IsTypeRegistered(objectClassType: TQ3ObjectType): TQ3Boolean; C;
  798.  *  Return true if the class with this name is registered, false if not 
  799.  }
  800. FUNCTION Q3ObjectHierarchy_IsNameRegistered(objectClassName: ConstCStringPtr): TQ3Boolean; C;
  801. {
  802.  * TQ3SubClassData is used when querying the object system for
  803.  * the subclasses of a particular parent type:
  804.  }
  805.  
  806. TYPE
  807.     TQ3SubClassDataPtr = ^TQ3SubClassData;
  808.     TQ3SubClassData = RECORD
  809.         numClasses:                UInt32;                                    {  the # of subclass types found for a parent class  }
  810.         classTypes:                TQ3ObjectTypePtr;                        {  an array containing the class types  }
  811.     END;
  812.  
  813. {
  814.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  815.  *  it in with the number and class types of all of the subclasses immediately
  816.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  817.  *  errors occurred, else kQ3Failure.
  818.  *
  819.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  820.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  821.  }
  822. FUNCTION Q3ObjectHierarchy_GetSubClassData(objectClassType: TQ3ObjectType; VAR subClassData: TQ3SubClassData): TQ3Status; C;
  823. {
  824.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  825.  *    by the Q3ObjectClass_GetSubClassData call.
  826.  *
  827.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  828.  *  to avoid memory leaks.
  829.  }
  830. FUNCTION Q3ObjectHierarchy_EmptySubClassData(VAR subClassData: TQ3SubClassData): TQ3Status; C;
  831.  
  832. {*****************************************************************************
  833.  **                                                                             **
  834.  **                                Object Routines                                 **
  835.  **                                                                             **
  836.  ****************************************************************************}
  837. FUNCTION Q3Object_Dispose(object: TQ3Object): TQ3Status; C;
  838. FUNCTION Q3Object_Duplicate(object: TQ3Object): TQ3Object; C;
  839. FUNCTION Q3Object_Submit(object: TQ3Object; view: TQ3ViewObject): TQ3Status; C;
  840. FUNCTION Q3Object_IsDrawable(object: TQ3Object): TQ3Boolean; C;
  841. FUNCTION Q3Object_IsWritable(object: TQ3Object; theFile: TQ3FileObject): TQ3Boolean; C;
  842.  
  843. {*****************************************************************************
  844.  **                                                                             **
  845.  **                            Object Type Routines                             **
  846.  **                                                                             **
  847.  ****************************************************************************}
  848. FUNCTION Q3Object_GetType(object: TQ3Object): TQ3ObjectType; C;
  849. FUNCTION Q3Object_GetLeafType(object: TQ3Object): TQ3ObjectType; C;
  850. FUNCTION Q3Object_IsType(object: TQ3Object; theType: TQ3ObjectType): TQ3Boolean; C;
  851.  
  852. {*****************************************************************************
  853.  **                                                                             **
  854.  **                            Shared Object Routines                             **
  855.  **                                                                             **
  856.  ****************************************************************************}
  857. FUNCTION Q3Shared_GetType(sharedObject: TQ3SharedObject): TQ3ObjectType; C;
  858. FUNCTION Q3Shared_GetReference(sharedObject: TQ3SharedObject): TQ3SharedObject; C;
  859.  *    Q3Shared_IsReferenced
  860.  *        Returns kQ3True if there is more than one reference to sharedObject.
  861.  *        Returns kQ3False if there is ONE reference to sharedObject.
  862.  *    
  863.  *    This call is intended to allow applications and plug-in objects to delete
  864.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  865.  *    caching objects, etc.
  866.  *    
  867.  *    Although many may be tempted, DO NOT DO THIS:
  868.  *        while (Q3Shared_IsReferenced(foo)) ( Q3Object_Dispose(foo); )
  869.  *    
  870.  *    Your application will crash and no one will buy it. Chapter 11 is 
  871.  *    never fun (unless you short the stock). Thanks.
  872.  }
  873. FUNCTION Q3Shared_IsReferenced(sharedObject: TQ3SharedObject): TQ3Boolean; C;
  874. {
  875.  *    Q3Shared_GetEditIndex
  876.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  877.  *        object information. Returns 0 on error.
  878.  *        
  879.  *        Hold onto this number to determine if an object has changed since you
  880.  *        last built your caches... To validate, do:
  881.  *        
  882.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) (
  883.  *            // Cache is valid
  884.  *        ) else (
  885.  *            // Cache is invalid
  886.  *            RebuildSomeSortOfCache(foo);
  887.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  888.  *        )
  889.  }
  890. FUNCTION Q3Shared_GetEditIndex(sharedObject: TQ3SharedObject): UInt32; C;
  891. {
  892.  *    Q3Shared_Edited
  893.  *        Bumps the "serial number" of sharedObject to a different value. This
  894.  *        call is intended to be used solely from a plug-in object which is 
  895.  *        shared. Call this whenever your private instance data changes.
  896.  *        
  897.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  898.  *            QuickDraw 3D isn't initialized.
  899.  }
  900. FUNCTION Q3Shared_Edited(sharedObject: TQ3SharedObject): TQ3Status; C;
  901.  
  902. {*****************************************************************************
  903.  **                                                                             **
  904.  **                                Shape Routines                                 **
  905.  **                                                                             **
  906.  ****************************************************************************}
  907. {
  908.  *    QuickDraw 3D 1.5 Note:
  909.  *
  910.  *    Shapes and Sets are now (sort of) polymorphic.
  911.  *
  912.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  913.  *        The following calls are identical, in implementation:
  914.  *
  915.  *            Q3Shape_GetElement            =    Q3Set_Get
  916.  *            Q3Shape_AddElement            =    Q3Set_Add
  917.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  918.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  919.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  920.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  921.  *
  922.  *    All of these calls accept a shape or a set as their first parameter.
  923.  *
  924.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  925.  *    element type kQ3ElementTypeSet. See the note above about 
  926.  *    kQ3ElementTypeSet;
  927.  *
  928.  *    It is important to note that the new Q3Shape_...Element... calls do not
  929.  *    create a set on a shape and then add the element to it. This data is
  930.  *    attached directly to the shape. Therefore, it is possible for an element
  931.  *    to exist on a shape without a set existing on it as well. 
  932.  *
  933.  *    In your application, if you attach an element to a shape like this:
  934.  *        (this isn't checking for errors for simplicity)
  935.  *
  936.  *        set = Q3Set_New();
  937.  *        Q3Set_AddElement(set, kMyElemType, &data);
  938.  *        Q3Shape_SetSet(shape, set);
  939.  *
  940.  *    You should retrieve it in the same manner:
  941.  *
  942.  *        Q3Shape_GetSet(shape, &set);
  943.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) (
  944.  *            Q3Set_Get(set, kMyElemType, &data);
  945.  *        )
  946.  *
  947.  *    Similarly, if you attach data to a shape with the new calls:
  948.  *
  949.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  950.  *
  951.  *    You should retrieve it in the same manner:
  952.  *
  953.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) (
  954.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  955.  *        )
  956.  *
  957.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  958.  *    metafiles.
  959.  *
  960.  *    When attempting to find a particular element on a shape, you should
  961.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  962.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  963.  *    and then Q3Shape_GetElement(set, ...).
  964.  *
  965.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  966.  *    used for sets of information that are shared among multiple shapes.
  967.  *    
  968.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  969.  *    for elements that are unique for a particular shape.
  970.  *    
  971.  }
  972. FUNCTION Q3Shape_GetType(shape: TQ3ShapeObject): TQ3ObjectType; C;
  973. FUNCTION Q3Shape_GetSet(shape: TQ3ShapeObject; VAR theSet: TQ3SetObject): TQ3Status; C;
  974. FUNCTION Q3Shape_SetSet(shape: TQ3ShapeObject; theSet: TQ3SetObject): TQ3Status; C;
  975. FUNCTION Q3Shape_AddElement(shape: TQ3ShapeObject; theType: TQ3ElementType; data: UNIV Ptr): TQ3Status; C;
  976. FUNCTION Q3Shape_GetElement(shape: TQ3ShapeObject; theType: TQ3ElementType; data: UNIV Ptr): TQ3Status; C;
  977. FUNCTION Q3Shape_ContainsElement(shape: TQ3ShapeObject; theType: TQ3ElementType): TQ3Boolean; C;
  978. FUNCTION Q3Shape_GetNextElementType(shape: TQ3ShapeObject; VAR theType: TQ3ElementType): TQ3Status; C;
  979. FUNCTION Q3Shape_EmptyElements(shape: TQ3ShapeObject): TQ3Status; C;
  980. FUNCTION Q3Shape_ClearElement(shape: TQ3ShapeObject; theType: TQ3ElementType): TQ3Status; C;
  981.  
  982. {*****************************************************************************
  983.  **                                                                             **
  984.  **                            Color Table Routines                             **
  985.  **                                                                             **
  986.  ****************************************************************************}
  987. FUNCTION Q3Bitmap_Empty(VAR bitmap: TQ3Bitmap): TQ3Status; C;
  988. FUNCTION Q3Bitmap_GetImageSize(width: UInt32; height: UInt32): UInt32; C;
  989.  
  990.  
  991. {$ALIGN RESET}
  992. {$POP}
  993.  
  994. {$SETC UsingIncludes := QD3DIncludes}
  995.  
  996. {$ENDC} {__QD3D__}
  997.  
  998. {$IFC NOT UsingIncludes}
  999.  END.
  1000. {$ENDC}
  1001.